﻿@model CTM.Web.Models.View.Feedback.FeedbackViewModel

@{
    ViewBag.Title = "Delete Feedback";
    Layout = Request.IsAjaxRequest() ? null : "~/Views/Shared/_Layout.cshtml";
}

@if (!Request.IsAjaxRequest())
{
    <h2>Delete Feedback</h2>
    <h3>Are you sure you want to delete this feedback?</h3>
}
else
{
    <h5>Are you sure you want to delete this feedback?</h5>
}

<div>
    @using (Ajax.BeginForm("Delete", "Feedback",
                    null,
                    new AjaxOptions { HttpMethod = "POST", OnSuccess = "OnDeleteFeedbackSuccess" },
                    new { @class = "form-horizontal", id = "delete-feedback-form" }))
    {
        @Html.AntiForgeryToken()

        if (!Request.IsAjaxRequest())
        {
            <div class="form-actions no-color">
                <input type="submit" value="Delete" class="btn btn-default" />
            </div>
        }
    }
</div>

<script>
    function OnDeleteFeedbackSuccess(data) {
        //Successful requests get here. Update the page elements
        $('#DeleteFeedbackModal').modal('hide');
        location.reload();
    }
</script>